Databases are key infrastructures in the fields such as finance, commerce, transportation, and even the entire society. Continuous availability of the database can ensure that services can be continuously provided for a user in the fields such as financial and commercial fields. To prevent a single database from being faulty and improve database availability, a primary database and a secondary database are usually configured. When the primary database is faulty, the primary database is switched to a secondary database to continue to serve the user.
In related technologies, switching between primary and secondary databases can be automatic. That is, a monitoring system is deployed for the primary database, and once finding that the primary database is abnormal, the monitoring system sends an alarm and a command for switching between primary and secondary databases.
However, in the previous method for switching between primary and secondary databases, the following case may occur due to incorrect judgment: The primary database is switched when the primary database is not faulty, or the primary database is faulty but is not switched. Consequently, normal services provided for the user are affected.